package com.example.personnel_oa.controller;

import com.example.comment_oa.pojos.SysDept;
import com.example.comment_oa.response.AjaxResponse;
import com.example.personnel_oa.service.SysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("personnelOa")
public class SysDeptController {

    @Autowired
    SysDeptService deptService;

    @PostMapping("dept/deptss")
    public AjaxResponse deptss(){
        List<SysDept> sysDepts = deptService.selectDepts();
        return AjaxResponse.success(sysDepts);
    }
    @PostMapping("dept/deptpost/{deptId}")
    public AjaxResponse deptpost(@PathVariable("deptId") int deptId){
        List<SysDept> sysDepts = deptService.selectDeptPost(deptId);
        return AjaxResponse.success(sysDepts);
    }

}
